<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

class CoreContext extends CoreObject {
	var $params = array();
	
	//constructor
	function CoreContext() {
		parent::CoreObject();
	}
	
	//param
	function pGet($k) {
		if( isset($_GET[$k]) ) {
			return $_GET[$k];
		}
		
		return NULL;
	}
	
	function pPost() {
		if( isset($_POST[$k]) ) {
			return $_POST[$k];
		}
		
		return NULL;
	}
	
	function pRequest() {
		if( isset($_REQUEST[$k]) ) {
			return $_REQUEST[$k];
		}
		
		return NULL;
	}
	
	function pCookie() {
		if( isset($_COOKIE[$k]) ) {
			return $_COOKIE[$k];
		}
		
		return NULL;
	}
	
	function pServer() {
		if( isset($_SERVER[$k]) ) {
			return $_SERVER[$k];
		}
		
		return NULL;
	}
	
	//params
	function param($k, $v) {
		$this->params[$k] = $v;
	}
	
	function params($ps) {
		foreach($ps as $k => $v) {
			$this->params[$k] = $v;
		}
	}
	
	function setParam($k, $v) {
		$this->params[$k] = $v;
	}
	
	function setParams($ps) {
		foreach($ps as $k => $v) {
			$this->params[$k] = $v;
		}
	}
	
	function getParam($k) {
		return $this->params[$k];
	}
	
	function getParams() {
		return $this->params;
	}
	
	//
	function uri() {
		
	}
	
	function ssl() {
		
	}
	
	function url() {
		
	}
	
	function referer() {
		$referer = $_SERVER['HTTP_REFERER'];
		
		return $referer;
	}
	
	function server($k) {
		return $_SERVER[$k];
	}
	
	function path() {
		
	}
	
	function header() {
		
	}
}
//
?>